import request from '@/utils/request'
import type { ApiResult, BaseIds, PageSchema } from '@/api/api'
import type { Form, FormAddDTO, FormModDTO, FormQueryDTO } from '@/api/process/form/type'

const BASE_URL = '/admin/api/v1/process/form'

const API = {
  BASE_URL,
  PAGE_URL : BASE_URL + '/page',
  LIST_URL : BASE_URL + '/list',
  REMOVE_URL : BASE_URL + '/rm',
}
// 添加表单信息
export const formAdd = (data: FormAddDTO) => {
  return request.post<any, ApiResult<unknown>>(API.BASE_URL, data)
}
// 修改表单信息
export const formMod = (data: FormModDTO) => {
  return request.put<any, ApiResult<unknown>>(API.BASE_URL, data)
}
// 删除表单信息
export const formDel = (data: BaseIds) => {
  return request.post<any, ApiResult<unknown>>(API.REMOVE_URL, data)
}
// 查询表单信息
export const formList = (data: FormQueryDTO) => {
  return request.post<any, ApiResult<Form[]>>(API.LIST_URL, data)
}
// 查询分页数据
export const formSelect = (data: FormQueryDTO) => {
  return request.post<any, ApiResult<PageSchema<Form>>>(API.PAGE_URL, data)
}

